
#ifndef __SYSTASK_H
#define	__SYSTASK_H

#include <stdint.h>
#include "dataproc.h"
#include "pulse.h"
#include "rtctime.h"
#include "common.h"
#include "iohandle.h"

#ifdef	__cplusplus
extern "C" {
#endif
	
#ifdef   _SYSTASK_MODULE_
#define  MY_EXT
#else
#define  MY_EXT  extern
#endif  

typedef struct
{
	uint16_t stack_used;
    uint32_t st;
	uint32_t srand[2];
} sys_info_type;

typedef struct 
{
    volatile uint32_t u_tick;
    volatile uint32_t powerup_time_cnt;
    volatile uint32_t clks_at_event_rcv;
    sys_info_type info;
	
    timer_pulse_type pulse;
    sig_time_type sig_time;
    TIME_Type rtc_time;
    float f_cpu_usage;
	
	struct 
	{
		uu8 nor_id[4];
		uu8 nor_sr[4];
		uu8 buff[256];
		uu32 rd_time;
		uu8 nand_id[8];
	} flash;
	
	struct
	{
		uu32 nand_write_req;
		uu32 nand_read_req;
		uu32 nand_cpage_rw_req;
		uu32 nand_page;
		uu8 exe_st;
	} fmc;
	
	struct
	{
		io_flt_type		sd_cd;
	} bios;
	
	struct
	{
		uint16_t copy_sd_to_afat;
		uint16_t copy_usb_to_afat;
		char fread_req;
		char fil_name[32];
	} cmd;
} sys_run_st_type;

MY_EXT sys_run_st_type sys_st;

#undef MY_EXT

#ifdef	__cplusplus
}
#endif

#endif	/* __SYSTASK_H */
